import com.qf.pojo.User;
import com.qf.service.Impl.UserServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @ClassName Demo
 * @Description TODO
 * @Author Windy
 * @Date 2022/8/30 11:36
 * @Version 1.0
 **/
public class Demo {
    @Test
    public void testBean(){
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        UserServiceImpl impl = (UserServiceImpl) context.getBean("userServiceImpl");
        impl.addUser();
        User user= (User) context.getBean("user");
        System.out.println(user.getName());
        ((ClassPathXmlApplicationContext)context).close();
    }
}
